home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / Drag.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  13.2 KB  |  600 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Drag.a
  3. ;
  4. ;    Contains:    Drag and Drop Interfaces.
  5. ;
  6. ;    Version:    Technology:    Macintosh Drag and Drop 1.1
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__DRAG__') = 'UNDEFINED' THEN
  21. __DRAG__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  25.     include 'AppleEvents.a'
  26.     ENDIF
  27. ;        include 'Errors.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'Types.a'                                            ;
  30. ;        include 'Memory.a'                                            ;
  31. ;            include 'MixedMode.a'                                    ;
  32. ;        include 'OSUtils.a'                                        ;
  33. ;        include 'Events.a'                                            ;
  34. ;            include 'Quickdraw.a'                                    ;
  35. ;                include 'QuickdrawText.a'                            ;
  36. ;        include 'EPPC.a'                                            ;
  37. ;            include 'AppleTalk.a'                                    ;
  38. ;            include 'Files.a'                                        ;
  39. ;                include 'Finder.a'                                    ;
  40. ;            include 'PPCToolbox.a'                                    ;
  41. ;            include 'Processes.a'                                    ;
  42. ;        include 'Notification.a'                                    ;
  43.  
  44.     IF &TYPE('__TEXTEDIT__') = 'UNDEFINED' THEN
  45.     include 'TextEdit.a'
  46.     ENDIF
  47.  
  48. ; Flavor Flags 
  49. flavorSenderOnly                EQU        $00000001            ; flavor is available to sender only 
  50. flavorSenderTranslated            EQU        $00000002            ; flavor is translated by sender 
  51. flavorNotSaved                    EQU        $00000004            ; flavor should not be saved 
  52. flavorSystemTranslated            EQU        $00000100            ; flavor is translated by system 
  53.  
  54. ; typedef unsigned long     FlavorFlags
  55.  
  56. ; Drag Attributes 
  57. dragHasLeftSenderWindow            EQU        $00000001            ; drag has left the source window since TrackDrag 
  58. dragInsideSenderApplication        EQU        $00000002            ; drag is occurring within the sender application 
  59. dragInsideSenderWindow            EQU        $00000004            ; drag is occurring within the sender window 
  60.  
  61. ; typedef unsigned long     DragAttributes
  62.  
  63. ; Special Flavor Types 
  64. flavorTypeHFS                    EQU        'hfs '                ; flavor type for HFS data 
  65. flavorTypePromiseHFS            EQU        'phfs'                ; flavor type for promised HFS data 
  66. flavorTypeDirectory                EQU        'diry'
  67.  
  68. ; Drag Tracking Handler Messages 
  69. dragTrackingEnterHandler        EQU        1                    ; drag has entered handler 
  70. dragTrackingEnterWindow            EQU        2                    ; drag has entered window 
  71. dragTrackingInWindow            EQU        3                    ; drag is moving within window 
  72. dragTrackingLeaveWindow            EQU        4                    ; drag has exited window 
  73. dragTrackingLeaveHandler        EQU        5                    ; drag has exited handler 
  74.  
  75. ; typedef short             DragTrackingMessage
  76.  
  77. ; Drag Drawing Procedure Messages 
  78. dragRegionBegin                    EQU        1                    ; initialize drawing 
  79. dragRegionDraw                    EQU        2                    ; draw drag feedback 
  80. dragRegionHide                    EQU        3                    ; hide drag feedback 
  81. dragRegionIdle                    EQU        4                    ; drag feedback idle time 
  82. dragRegionEnd                    EQU        5                    ; end of drawing 
  83.  
  84. ; typedef short             DragRegionMessage
  85.  
  86. ; Zoom Acceleration 
  87. zoomNoAcceleration                EQU        0                    ; use linear interpolation 
  88. zoomAccelerate                    EQU        1                    ; ramp up step size 
  89. zoomDecelerate                    EQU        2                    ; ramp down step size 
  90.  
  91. ; typedef short             ZoomAcceleration
  92. ; Drag Manager Data Types 
  93. ; typedef unsigned long     DragReference
  94. ; typedef unsigned long     ItemReference
  95. ; typedef ResType             FlavorType
  96. ; HFS Flavors 
  97. HFSFlavor                 RECORD    0
  98. fileType                 ds.l   1        ; offset: $0 (0)        ; file type 
  99. fileCreator                 ds.l   1        ; offset: $4 (4)        ; file creator 
  100. fdFlags                     ds.w   1        ; offset: $8 (8)        ; Finder flags 
  101. fileSpec                 ds     FSSpec    ; offset: $A (10)        ; file system specification 
  102. sizeof                     EQU *            ; size:   $50 (80)
  103.                         ENDR
  104.  
  105. ; typedef struct HFSFlavor     HFSFlavor
  106. PromiseHFSFlavor         RECORD    0
  107. fileType                 ds.l   1        ; offset: $0 (0)        ; file type 
  108. fileCreator                 ds.l   1        ; offset: $4 (4)        ; file creator 
  109. fdFlags                     ds.w   1        ; offset: $8 (8)        ; Finder flags 
  110. promisedFlavor             ds.l   1        ; offset: $A (10)        ; promised flavor containing an FSSpec 
  111. sizeof                     EQU *            ; size:   $E (14)
  112.                         ENDR
  113.  
  114. ; typedef struct PromiseHFSFlavor  PromiseHFSFlavor
  115. ; Application-Defined Drag Handler Routines 
  116. ; typedef DragTrackingHandlerUPP  DragTrackingHandler
  117. ; typedef DragReceiveHandlerUPP  DragReceiveHandler
  118. ; Application-Defined Routines 
  119. ; typedef DragSendDataUPP     DragSendDataProc
  120. ; typedef DragInputUPP         DragInputProc
  121. ; typedef DragDrawingUPP     DragDrawingProc
  122. ; Drag Manager Routines 
  123. ; Installing and Removing Drag Handlers 
  124. ;
  125. ; pascal OSErr InstallTrackingHandler(DragTrackingHandler trackingHandler, WindowPtr theWindow, void *handlerRefCon)
  126. ;
  127.     IF ¬ GENERATINGCFM THEN
  128.         Macro
  129.         _InstallTrackingHandler
  130.             moveq    #1,d0
  131.             dc.w     $ABED
  132.         EndM
  133.     ELSE
  134.         IMPORT_CFM_FUNCTION    InstallTrackingHandler
  135.     ENDIF
  136.  
  137. ;
  138. ; pascal OSErr InstallReceiveHandler(DragReceiveHandler receiveHandler, WindowPtr theWindow, void *handlerRefCon)
  139. ;
  140.     IF ¬ GENERATINGCFM THEN
  141.         Macro
  142.         _InstallReceiveHandler
  143.             moveq    #2,d0
  144.             dc.w     $ABED
  145.         EndM
  146.     ELSE
  147.         IMPORT_CFM_FUNCTION    InstallReceiveHandler
  148.     ENDIF
  149.  
  150. ;
  151. ; pascal OSErr RemoveTrackingHandler(DragTrackingHandler trackingHandler, WindowPtr theWindow)
  152. ;
  153.     IF ¬ GENERATINGCFM THEN
  154.         Macro
  155.         _RemoveTrackingHandler
  156.             moveq    #3,d0
  157.             dc.w     $ABED
  158.         EndM
  159.     ELSE
  160.         IMPORT_CFM_FUNCTION    RemoveTrackingHandler
  161.     ENDIF
  162.  
  163. ;
  164. ; pascal OSErr RemoveReceiveHandler(DragReceiveHandler receiveHandler, WindowPtr theWindow)
  165. ;
  166.     IF ¬ GENERATINGCFM THEN
  167.         Macro
  168.         _RemoveReceiveHandler
  169.             moveq    #4,d0
  170.             dc.w     $ABED
  171.         EndM
  172.     ELSE
  173.         IMPORT_CFM_FUNCTION    RemoveReceiveHandler
  174.     ENDIF
  175.  
  176. ; Creating and Disposing Drag References 
  177. ;
  178. ; pascal OSErr NewDrag(DragReference *theDragRef)
  179. ;
  180.     IF ¬ GENERATINGCFM THEN
  181.         Macro
  182.         _NewDrag
  183.             moveq    #5,d0
  184.             dc.w     $ABED
  185.         EndM
  186.     ELSE
  187.         IMPORT_CFM_FUNCTION    NewDrag
  188.     ENDIF
  189.  
  190. ;
  191. ; pascal OSErr DisposeDrag(DragReference theDragRef)
  192. ;
  193.     IF ¬ GENERATINGCFM THEN
  194.         Macro
  195.         _DisposeDrag
  196.             moveq    #6,d0
  197.             dc.w     $ABED
  198.         EndM
  199.     ELSE
  200.         IMPORT_CFM_FUNCTION    DisposeDrag
  201.     ENDIF
  202.  
  203. ; Adding Drag Item Flavors 
  204. ;
  205. ; pascal OSErr AddDragItemFlavor(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, void *dataPtr, Size dataSize, FlavorFlags theFlags)
  206. ;
  207.     IF ¬ GENERATINGCFM THEN
  208.         Macro
  209.         _AddDragItemFlavor
  210.             moveq    #7,d0
  211.             dc.w     $ABED
  212.         EndM
  213.     ELSE
  214.         IMPORT_CFM_FUNCTION    AddDragItemFlavor
  215.     ENDIF
  216.  
  217. ;
  218. ; pascal OSErr SetDragItemFlavorData(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, const void *dataPtr, Size dataSize, unsigned long dataOffset)
  219. ;
  220.     IF ¬ GENERATINGCFM THEN
  221.         Macro
  222.         _SetDragItemFlavorData
  223.             moveq    #9,d0
  224.             dc.w     $ABED
  225.         EndM
  226.     ELSE
  227.         IMPORT_CFM_FUNCTION    SetDragItemFlavorData
  228.     ENDIF
  229.  
  230. ; Providing Drag Callback Procedures 
  231. ;
  232. ; pascal OSErr SetDragSendProc(DragReference theDragRef, DragSendDataProc sendProc, void *dragSendRefCon)
  233. ;
  234.     IF ¬ GENERATINGCFM THEN
  235.         Macro
  236.         _SetDragSendProc
  237.             moveq    #10,d0
  238.             dc.w     $ABED
  239.         EndM
  240.     ELSE
  241.         IMPORT_CFM_FUNCTION    SetDragSendProc
  242.     ENDIF
  243.  
  244. ;
  245. ; pascal OSErr SetDragInputProc(DragReference theDragRef, DragInputProc inputProc, void *dragInputRefCon)
  246. ;
  247.     IF ¬ GENERATINGCFM THEN
  248.         Macro
  249.         _SetDragInputProc
  250.             moveq    #11,d0
  251.             dc.w     $ABED
  252.         EndM
  253.     ELSE
  254.         IMPORT_CFM_FUNCTION    SetDragInputProc
  255.     ENDIF
  256.  
  257. ;
  258. ; pascal OSErr SetDragDrawingProc(DragReference theDragRef, DragDrawingProc drawingProc, void *dragDrawingRefCon)
  259. ;
  260.     IF ¬ GENERATINGCFM THEN
  261.         Macro
  262.         _SetDragDrawingProc
  263.             moveq    #12,d0
  264.             dc.w     $ABED
  265.         EndM
  266.     ELSE
  267.         IMPORT_CFM_FUNCTION    SetDragDrawingProc
  268.     ENDIF
  269.  
  270. ;
  271. ; pascal OSErr TrackDrag(DragReference theDragRef, const EventRecord *theEvent, RgnHandle theRegion)
  272. ;
  273.     IF ¬ GENERATINGCFM THEN
  274.         Macro
  275.         _TrackDrag
  276.             moveq    #13,d0
  277.             dc.w     $ABED
  278.         EndM
  279.     ELSE
  280.         IMPORT_CFM_FUNCTION    TrackDrag
  281.     ENDIF
  282.  
  283. ; Getting Drag Item Information 
  284. ;
  285. ; pascal OSErr CountDragItems(DragReference theDragRef, unsigned short *numItems)
  286. ;
  287.     IF ¬ GENERATINGCFM THEN
  288.         Macro
  289.         _CountDragItems
  290.             moveq    #14,d0
  291.             dc.w     $ABED
  292.         EndM
  293.     ELSE
  294.         IMPORT_CFM_FUNCTION    CountDragItems
  295.     ENDIF
  296.  
  297. ;
  298. ; pascal OSErr GetDragItemReferenceNumber(DragReference theDragRef, unsigned short index, ItemReference *theItemRef)
  299. ;
  300.     IF ¬ GENERATINGCFM THEN
  301.         Macro
  302.         _GetDragItemReferenceNumber
  303.             moveq    #15,d0
  304.             dc.w     $ABED
  305.         EndM
  306.     ELSE
  307.         IMPORT_CFM_FUNCTION    GetDragItemReferenceNumber
  308.     ENDIF
  309.  
  310. ;
  311. ; pascal OSErr CountDragItemFlavors(DragReference theDragRef, ItemReference theItemRef, unsigned short *numFlavors)
  312. ;
  313.     IF ¬ GENERATINGCFM THEN
  314.         Macro
  315.         _CountDragItemFlavors
  316.             moveq    #16,d0
  317.             dc.w     $ABED
  318.         EndM
  319.     ELSE
  320.         IMPORT_CFM_FUNCTION    CountDragItemFlavors
  321.     ENDIF
  322.  
  323. ;
  324. ; pascal OSErr GetFlavorType(DragReference theDragRef, ItemReference theItemRef, unsigned short index, FlavorType *theType)
  325. ;
  326.     IF ¬ GENERATINGCFM THEN
  327.         Macro
  328.         _GetFlavorType
  329.             moveq    #17,d0
  330.             dc.w     $ABED
  331.         EndM
  332.     ELSE
  333.         IMPORT_CFM_FUNCTION    GetFlavorType
  334.     ENDIF
  335.  
  336. ;
  337. ; pascal OSErr GetFlavorFlags(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, FlavorFlags *theFlags)
  338. ;
  339.     IF ¬ GENERATINGCFM THEN
  340.         Macro
  341.         _GetFlavorFlags
  342.             moveq    #18,d0
  343.             dc.w     $ABED
  344.         EndM
  345.     ELSE
  346.         IMPORT_CFM_FUNCTION    GetFlavorFlags
  347.     ENDIF
  348.  
  349. ;
  350. ; pascal OSErr GetFlavorDataSize(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, Size *dataSize)
  351. ;
  352.     IF ¬ GENERATINGCFM THEN
  353.         Macro
  354.         _GetFlavorDataSize
  355.             moveq    #19,d0
  356.             dc.w     $ABED
  357.         EndM
  358.     ELSE
  359.         IMPORT_CFM_FUNCTION    GetFlavorDataSize
  360.     ENDIF
  361.  
  362. ;
  363. ; pascal OSErr GetFlavorData(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, void *dataPtr, Size *dataSize, unsigned long dataOffset)
  364. ;
  365.     IF ¬ GENERATINGCFM THEN
  366.         Macro
  367.         _GetFlavorData
  368.             moveq    #20,d0
  369.             dc.w     $ABED
  370.         EndM
  371.     ELSE
  372.         IMPORT_CFM_FUNCTION    GetFlavorData
  373.     ENDIF
  374.  
  375. ;
  376. ; pascal OSErr GetDragItemBounds(DragReference theDragRef, ItemReference theItemRef, Rect *itemBounds)
  377. ;
  378.     IF ¬ GENERATINGCFM THEN
  379.         Macro
  380.         _GetDragItemBounds
  381.             moveq    #21,d0
  382.             dc.w     $ABED
  383.         EndM
  384.     ELSE
  385.         IMPORT_CFM_FUNCTION    GetDragItemBounds
  386.     ENDIF
  387.  
  388. ;
  389. ; pascal OSErr SetDragItemBounds(DragReference theDragRef, ItemReference theItemRef, const Rect *itemBounds)
  390. ;
  391.     IF ¬ GENERATINGCFM THEN
  392.         Macro
  393.         _SetDragItemBounds
  394.             moveq    #22,d0
  395.             dc.w     $ABED
  396.         EndM
  397.     ELSE
  398.         IMPORT_CFM_FUNCTION    SetDragItemBounds
  399.     ENDIF
  400.  
  401. ;
  402. ; pascal OSErr GetDropLocation(DragReference theDragRef, AEDesc *dropLocation)
  403. ;
  404.     IF ¬ GENERATINGCFM THEN
  405.         Macro
  406.         _GetDropLocation
  407.             moveq    #23,d0
  408.             dc.w     $ABED
  409.         EndM
  410.     ELSE
  411.         IMPORT_CFM_FUNCTION    GetDropLocation
  412.     ENDIF
  413.  
  414. ;
  415. ; pascal OSErr SetDropLocation(DragReference theDragRef, const AEDesc *dropLocation)
  416. ;
  417.     IF ¬ GENERATINGCFM THEN
  418.         Macro
  419.         _SetDropLocation
  420.             moveq    #24,d0
  421.             dc.w     $ABED
  422.         EndM
  423.     ELSE
  424.         IMPORT_CFM_FUNCTION    SetDropLocation
  425.     ENDIF
  426.  
  427. ; Getting Information About a Drag 
  428. ;
  429. ; pascal OSErr GetDragAttributes(DragReference theDragRef, DragAttributes *flags)
  430. ;
  431.     IF ¬ GENERATINGCFM THEN
  432.         Macro
  433.         _GetDragAttributes
  434.             moveq    #25,d0
  435.             dc.w     $ABED
  436.         EndM
  437.     ELSE
  438.         IMPORT_CFM_FUNCTION    GetDragAttributes
  439.     ENDIF
  440.  
  441. ;
  442. ; pascal OSErr GetDragMouse(DragReference theDragRef, Point *mouse, Point *pinnedMouse)
  443. ;
  444.     IF ¬ GENERATINGCFM THEN
  445.         Macro
  446.         _GetDragMouse
  447.             moveq    #26,d0
  448.             dc.w     $ABED
  449.         EndM
  450.     ELSE
  451.         IMPORT_CFM_FUNCTION    GetDragMouse
  452.     ENDIF
  453.  
  454. ;
  455. ; pascal OSErr SetDragMouse(DragReference theDragRef, Point pinnedMouse)
  456. ;
  457.     IF ¬ GENERATINGCFM THEN
  458.         Macro
  459.         _SetDragMouse
  460.             moveq    #27,d0
  461.             dc.w     $ABED
  462.         EndM
  463.     ELSE
  464.         IMPORT_CFM_FUNCTION    SetDragMouse
  465.     ENDIF
  466.  
  467. ;
  468. ; pascal OSErr GetDragOrigin(DragReference theDragRef, Point *initialMouse)
  469. ;
  470.     IF ¬ GENERATINGCFM THEN
  471.         Macro
  472.         _GetDragOrigin
  473.             moveq    #28,d0
  474.             dc.w     $ABED
  475.         EndM
  476.     ELSE
  477.         IMPORT_CFM_FUNCTION    GetDragOrigin
  478.     ENDIF
  479.  
  480. ;
  481. ; pascal OSErr GetDragModifiers(DragReference theDragRef, short *modifiers, short *mouseDownModifiers, short *mouseUpModifiers)
  482. ;
  483.     IF ¬ GENERATINGCFM THEN
  484.         Macro
  485.         _GetDragModifiers
  486.             moveq    #29,d0
  487.             dc.w     $ABED
  488.         EndM
  489.     ELSE
  490.         IMPORT_CFM_FUNCTION    GetDragModifiers
  491.     ENDIF
  492.  
  493. ; Drag Highlighting 
  494. ;
  495. ; pascal OSErr ShowDragHilite(DragReference theDragRef, RgnHandle hiliteFrame, Boolean inside)
  496. ;
  497.     IF ¬ GENERATINGCFM THEN
  498.         Macro
  499.         _ShowDragHilite
  500.             moveq    #30,d0
  501.             dc.w     $ABED
  502.         EndM
  503.     ELSE
  504.         IMPORT_CFM_FUNCTION    ShowDragHilite
  505.     ENDIF
  506.  
  507. ;
  508. ; pascal OSErr HideDragHilite(DragReference theDragRef)
  509. ;
  510.     IF ¬ GENERATINGCFM THEN
  511.         Macro
  512.         _HideDragHilite
  513.             moveq    #31,d0
  514.             dc.w     $ABED
  515.         EndM
  516.     ELSE
  517.         IMPORT_CFM_FUNCTION    HideDragHilite
  518.     ENDIF
  519.  
  520. ;
  521. ; pascal OSErr DragPreScroll(DragReference theDragRef, short dH, short dV)
  522. ;
  523.     IF ¬ GENERATINGCFM THEN
  524.         Macro
  525.         _DragPreScroll
  526.             moveq    #32,d0
  527.             dc.w     $ABED
  528.         EndM
  529.     ELSE
  530.         IMPORT_CFM_FUNCTION    DragPreScroll
  531.     ENDIF
  532.  
  533. ;
  534. ; pascal OSErr DragPostScroll(DragReference theDragRef)
  535. ;
  536.     IF ¬ GENERATINGCFM THEN
  537.         Macro
  538.         _DragPostScroll
  539.             moveq    #33,d0
  540.             dc.w     $ABED
  541.         EndM
  542.     ELSE
  543.         IMPORT_CFM_FUNCTION    DragPostScroll
  544.     ENDIF
  545.  
  546. ;
  547. ; pascal OSErr UpdateDragHilite(DragReference theDragRef, RgnHandle updateRgn)
  548. ;
  549.     IF ¬ GENERATINGCFM THEN
  550.         Macro
  551.         _UpdateDragHilite
  552.             moveq    #34,d0
  553.             dc.w     $ABED
  554.         EndM
  555.     ELSE
  556.         IMPORT_CFM_FUNCTION    UpdateDragHilite
  557.     ENDIF
  558.  
  559. ; Drag Manager Utilities 
  560. ;
  561. ; pascal Boolean WaitMouseMoved(Point initialMouse)
  562. ;
  563.     IF ¬ GENERATINGCFM THEN
  564.         Macro
  565.         _WaitMouseMoved
  566.             moveq    #35,d0
  567.             dc.w     $ABED
  568.         EndM
  569.     ELSE
  570.         IMPORT_CFM_FUNCTION    WaitMouseMoved
  571.     ENDIF
  572.  
  573. ;
  574. ; pascal OSErr ZoomRects(const Rect *fromRect, const Rect *toRect, short zoomSteps, ZoomAcceleration acceleration)
  575. ;
  576.     IF ¬ GENERATINGCFM THEN
  577.         Macro
  578.         _ZoomRects
  579.             moveq    #36,d0
  580.             dc.w     $ABED
  581.         EndM
  582.     ELSE
  583.         IMPORT_CFM_FUNCTION    ZoomRects
  584.     ENDIF
  585.  
  586. ;
  587. ; pascal OSErr ZoomRegion(RgnHandle region, Point zoomDistance, short zoomSteps, ZoomAcceleration acceleration)
  588. ;
  589.     IF ¬ GENERATINGCFM THEN
  590.         Macro
  591.         _ZoomRegion
  592.             moveq    #37,d0
  593.             dc.w     $ABED
  594.         EndM
  595.     ELSE
  596.         IMPORT_CFM_FUNCTION    ZoomRegion
  597.     ENDIF
  598.  
  599.     ENDIF ; __DRAG__
  600.